/**
 * Copyright(c) 2025 hbswxx.com, All Rights Reserved. Author: kouqiang Create date: 2025/5/30
 */
package cn.sw.syncdata.job;

import cn.sw.syncdata.job.heart.ThreadCreatePort;
import cn.sw.syncdata.threadpool.ThreadPoolManager;
import org.mybatis.logging.Logger;
import org.mybatis.logging.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * description:
 *
 * @author kouqiang
 * @date 2025/5/30 09:05
 */
@Service
public class CreatePortJob {

    private static final Logger log = LoggerFactory.getLogger(CreatePortJob.class);

    private final int limit = 3000000;

    /***
     * description:  生成任务
     * @author kouqiang
     * @date 2025/5/30 09:08
     * @param startId 开始的id
     * @param sdate 生成的日期区间
     * @param edate
     * @param total 总数
     * @return: void
     */

    public void createPortJob(String sdate, String edate, int total) {
        //判断需要执行的任务线程数
//        int limit=total/10;
        int numJob = total / limit + 1;
        System.out.println("开始创建aiport数据，合计任务数量" + numJob);
        for (int i = 0; i < numJob; i++) {
            ThreadCreatePort threadCreatePort = new ThreadCreatePort(limit, "d:\\tmp\\port" + i + ".csv", sdate, edate);
            ThreadPoolManager.submitThread(threadCreatePort);
        }
    }
}
